home *** CD-ROM | disk | FTP | other *** search
- head 1.2;
- branch ;
- access ;
- symbols ;
- locks gtoal:1.2;
- comment @ * @;
-
-
- 1.2
- date 91.03.02.13.59.24; author gtoal; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 91.03.02.13.56.10; author gtoal; state Exp;
- branches ;
- next ;
-
-
- desc
- @Initial release
- @
-
-
- 1.2
- log
- @IAY's upgrade
- @
- text
- @/* c.routines --- auxilary routines. */
-
- #include <stdarg.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include "d2rd.h"
- #include "kernel.h"
-
- int
- fatal (const char *fmt, ...)
- {
- va_list ap;
- static struct
- {
- int dummy;
- char msg[2048];
- } msg;
-
- va_start (ap, fmt);
- vsprintf (msg.msg, fmt, ap);
- va_end (ap);
-
- wimp_reporterror ((os_error *) &msg, wimp_EHICANCEL, PROGRAM_NAME);
-
- return (-1);
- }
-
-
- void
- tfatal (const char *fmt, ...)
- {
- va_list ap;
- static struct
- {
- int dummy;
- char msg[2048];
- } msg;
-
- va_start (ap, fmt);
- vsprintf (msg.msg, fmt, ap);
- va_end (ap);
-
- wimp_reporterror ((os_error *) &msg, wimp_EHICANCEL, PROGRAM_NAME);
- exit (1);
- }
-
-
- void *
- xmalloc (int i)
- {
- void *r = malloc (i ? i : 1);
-
- if (r == NULL)
- {
- tfatal ("Out of VM\n");
- abort ();
- }
- return (r);
- }
-
-
- void *
- xcalloc (int i, int j)
- {
- void *r = calloc (i, j);
-
- if (r == NULL)
- {
- tfatal ("Out of VM\n");
- abort ();
- }
- return (r);
- }
-
-
- void *
- xrealloc (void *i, int j)
- {
- void *r = realloc (i, j);
-
- if (r == NULL && j != 0)
- {
- tfatal ("Out of VM\n");
- abort ();
- }
- return (r);
- }
-
- /* EOF */
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @@
-